<template>
  <div class="email-sent-page">
    <div class="register-left">
      <div class="logo-container">
        <router-link to="/">
          <img src="/logo.png" alt="LOGO" class="logo">
        </router-link>
      </div>
      <div class="register-box">
        <h2 class="register-title">新規会員登録</h2>
        <p class="register-subtitle">仮登録ありがとうございます</p>
        <strong style="text-align: center; display: block;">{{ email }}</strong>
        <div class="email-sent-container">
          <el-icon class="email-sent-icon"><img src="/img/icons8-telegram-24.png" alt=""></el-icon>
          <p class="email-login-subtext">登録確認コードがメールに送信されました</p>
          <p class="fontshow">メールで確認コードを確認し、下の「登録を続けるにはクリックしてください」ボタンをクリックして登録を続けてください。</p>
          <el-button 
            type="primary" 
            class="register-button" 
            style="width: 227px; margin-top: 20px;height: 32px;background-color: #409EFF;border: none;font-size: 14px;" 
            @click="handleContinue" 
            :disabled="isEmailSending" 
            :loading="isEmailSending"
          >
            {{ isEmailSending ? '送信中...' : 'クリックして登録を続行します' }}
          </el-button>
          <div class="line"></div>
          <p class="fontshow" style="text-align: left;">※電子メールに含まれる登録確認コードの有効期限は 15 分間です。有効期限が切れている場合は、メールアドレスを再度入力してください</p>
          <p>
            
            <em>
              <span style="float: left; font-weight: bold;font-family: 
               'Hiragino Kaku Gothic Pro', sans-serif;color: #353d48; margin-top: 10px;">※確認メールが届かない場合</span>
              <br>
              <p class="fontshow" style="line-height: 12px;">迷惑メールフォルダに振り分けられていることもありますのでご確認ください。また、[billerbeckgongstno3556@gmail.com]ドメインの受信を可能に設定してください。</p>
            </em>
          </p>
        </div>
      </div>
    </div>
      <div class="footdt">
    <div>
      <span>利用規約</span>
      <span>|</span>
      <span>特定商取引法に基づく表記</span>
      <span>|</span>
      <span><a href="/article/3">個人情報保護方針</a></span>
    </div>
    <div class="copyright">
      copyright (c) WorkMatch all rights reserved.
    </div>
  </div>
  </div>
</template>

<script setup>
import { ref, computed, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { Promotion } from '@element-plus/icons-vue'

// 初始化路由
const router = useRouter()
const route = useRoute()

// 响应式数据
const email = ref('')
const isEmailSending = ref(false)
const isSendingCode = ref(false)
const countdown = ref(0)

// 页面加载时获取邮箱信息
onMounted(() => {
  // 从路由参数或查询参数中获取邮箱
  email.value = route.query.email || route.params.email || ''
})

// 计算验证码按钮文本
const codeButtonText = computed(() => {
  if (isSendingCode.value && countdown.value > 0) {
    return `${countdown.value}秒後に再試行`
  }
  return '重新发送'
})

// 处理继续注册 - 跳转到注册表单页面
const handleContinue = () => {
  router.push({
    path: '/register-form',
    query: { email: email.value }
  })
}

// 处理更改邮箱 - 返回到邮箱输入步骤
const handleChangeEmail = () => {
  router.push('/register')
}

// 处理重新发送验证码
const handleResendCode = () => {
  // 这里可以添加重新发送验证码的逻辑
  console.log('重新发送验证码')
}
</script>

<style scoped>
.footdt {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #004980;
  font-size: 12px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px 0;
  background-color: #e7f1fa;
}

.footdt .copyright {
  margin-top: 10px;
  font-size: 10px;
  color: #004980;
}

.footdt span {
  margin: 0 5px;
}
.email-sent-page {
  width: 100%;
  min-height: 100vh;
  background-color: #e7f1fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.register-content .register-left {
  transition: all 0.3s ease;
}

.register-content .register-left:only-child,
.register-content .register-left:nth-last-child(1):first-child {
  flex: 1 1 100%;
  max-width: 100%;
}

.register-left {
  position: absolute;
  top: 0.5rem;
  flex: 1;
  padding: 30px;
  display: flex;
  flex-direction: column;
  margin-right: 0px;
  background-color: transparent;
}

.logo {
  width: 165px;
  height: 55px;
  object-fit: contain;
}

.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 35px;
}

.logo-container a {
  display: inline-block;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.logo-container a:hover {
  transform: scale(1.05);
}

.register-box {
  width: 100%;
  max-width: 1152.49px;
  margin: 0 auto;
  background-color: rgb(255, 255, 255);
  padding: 30px;
  border-radius: 8px;
  height: 566px;
}

.register-title {
  font: 700 22px / 1 "Hiragino Kaku Gothic Pro", sans-serif;
  color: #353d48;
  margin: 5px 0px 25px 0;
  text-align: center;
}

.email-sent-container {
  text-align: center;
  padding: 20px;
}

.email-sent-icon {
  width: 50px;
  height: 50px;
  color: #409eff;
  margin-bottom: 10px;
}

.email-login-subtext {
  color: #353d48;
  font: 700 16px / 1.8 "Hiragino Kaku Gothic Pro", sans-serif;
  margin: 0;
  margin-bottom: -10px;
}

.email-sent-title {
  font-size: 20px;
  color: #333;
  margin-bottom: 10px;
}

.email-sent-text {
  font-size: 16px;
  color: #666;
  margin-bottom: 10px;
}

.email-sent-subtext {
  font-size: 14px;
  color: #999;
  margin-bottom: 20px;
}

.fontshow {
  text-align: center;
  margin: 10px 0;
  color: #353d48;
  font-size: 14px;

}

.line {
  border-top: 2px solid #dcdfe6;
  margin: 20px 0;
  width: 100%;
}

.register-options {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.change-email-btn,
.resend-code-btn {
  color: #409eff;
  font-size: 14px;
}

.change-email-btn:hover,
.resend-code-btn:hover {
  color: #66b1ff;
}

.register-subtitle {
  color: #006ab6;
  font: 700 22px / 1 "Hiragino Kaku Gothic Pro", sans-serif;
  margin: 0;
  text-align: center;
  margin-bottom: 20px;
}

/* 移动端响应式样式 - 最优化版本 */
@media (max-width: 768px) {
  .email-sent-page {
    padding: 10px;
    min-height: 100vh;
  }

  .register-left {
    width: 100%;
    padding: 0;
    position: static;
    top: auto;
  }

  .logo-container {
    margin-bottom: 15px;
    text-align: center;
  }

  .logo {
    height: 45px;
    width: auto;
  }

  .register-box {
    width: 100%;
    max-width: 100%;
    padding: 25px 20px;
    margin: 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    height: auto;
  }

  .register-title {
    font-size: 20px;
    margin-bottom: 15px;
    line-height: 1.3;
  }

  .register-subtitle {
    font-size: 18px;
    margin-bottom: 15px;
  }

  .email-sent-container {
    padding: 20px 15px;
  }

  .email-sent-icon {
    font-size: 48px;
    margin-bottom: 20px;
  }

  .email-login-subtext {
    font-size: 16px;
    margin-bottom: 15px;
    line-height: 1.4;
  }

  .email-sent-title {
    font-size: 18px;
    margin-bottom: 10px;
    line-height: 1.4;
  }

  .email-sent-text {
    font-size: 15px;
    margin-bottom: 10px;
    line-height: 1.5;
  }

  .email-sent-subtext {
    font-size: 14px;
    margin-bottom: 18px;
    line-height: 1.4;
  }

  .fontshow {
    font-size: 14px;
    margin: 10px 0;
    line-height: 1.6;
    padding: 0 5px;
  }

  .line {
    margin: 20px 0;
    border-top-width: 1px;
  }

  .register-button {
    width: 100% !important;
    max-width: 280px;
    height: 50px !important;
    font-size: 16px !important;
    border-radius: 8px;
    font-weight: 500;
    margin: 20px auto 0 auto !important;
    display: block;
  }

  /* 邮箱显示优化 */
  strong {
    font-size: 16px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    margin: 15px 0;
    display: block;
    word-break: break-all;
  }

  .register-options {
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    align-items: center;
  }

  /* 链接和按钮容器居中 */
  .button-container {
    text-align: center;
  }
}

/* 小屏设备优化 (≤480px) */
@media (max-width: 480px) {
  .email-sent-page {
    padding: 8px;
  }

  .register-box {
    padding: 20px 15px;
    border-radius: 10px;
  }

  .register-title {
    font-size: 18px;
    margin-bottom: 12px;
  }

  .register-subtitle {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .email-sent-container {
    padding: 15px 10px;
  }

  .email-sent-icon {
    font-size: 42px;
    margin-bottom: 18px;
  }

  .email-login-subtext {
    font-size: 15px;
    margin-bottom: 12px;
  }

  .email-sent-title {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .email-sent-text {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .email-sent-subtext {
    font-size: 13px;
    margin-bottom: 15px;
  }

  .fontshow {
    font-size: 13px;
    margin: 8px 0;
    line-height: 1.5;
    padding: 0 3px;
  }

  .register-button {
    height: 48px !important;
    font-size: 15px !important;
    margin: 15px auto 0 auto !important;
  }

  strong {
    font-size: 15px;
    padding: 8px;
    margin: 12px 0;
  }
}

/* 超小屏设备优化 (≤360px) */
@media (max-width: 360px) {
  .email-sent-page {
    padding: 5px;
  }

  .register-box {
    padding: 15px 12px;
  }

  .register-title {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .register-subtitle {
    font-size: 15px;
    margin-bottom: 10px;
  }

  .email-sent-container {
    padding: 12px 8px;
  }

  .email-sent-icon {
    font-size: 38px;
    margin-bottom: 15px;
  }

  .email-login-subtext {
    font-size: 14px;
  }

  .email-sent-title {
    font-size: 15px;
  }

  .email-sent-text {
    font-size: 13px;
  }

  .email-sent-subtext {
    font-size: 12px;
  }

  .fontshow {
    font-size: 12px;
    line-height: 1.4;
  }

  .register-button {
    height: 46px !important;
    font-size: 14px !important;
  }

  strong {
    font-size: 14px;
    padding: 6px;
  }

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .email-sent-page {
    padding: 5px;
  }

  .register-box {
    padding: 15px;
  }

  .register-title {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .register-subtitle {
    font-size: 15px;
    margin-bottom: 8px;
  }

  .email-sent-container {
    padding: 10px;
  }

  .email-sent-icon {
    font-size: 32px;
    margin-bottom: 10px;
  }

  .email-login-subtext {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .email-sent-title {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .email-sent-text {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .email-sent-subtext {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .fontshow {
    font-size: 12px;
    margin: 6px 0;
    line-height: 1.3;
  }

  .line {
    margin: 10px 0;
  }

  .register-button {
    height: 42px !important;
    font-size: 14px !important;
    margin: 10px auto 0 auto !important;
  }

  .register-options {
    gap: 8px;
    margin-top: 10px;
  }

  strong {
    font-size: 13px;
    padding: 5px;
    margin: 8px 0;
  }

  .change-email-btn,
  .resend-code-btn {
    font-size: 14px;
    padding: 8px 16px;
    min-height: 36px;
    border-radius: 6px;
    width: 100%;
    max-width: 200px;
  }
}

/* 小屏幕手机端优化 */
@media (max-width: 480px) {
  .register-box {
    padding: 15px 12px;
    border-radius: 8px;
  }

  .register-title {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .email-sent-container {
    padding: 12px 8px;
  }

  .email-sent-icon {
    font-size: 36px;
    margin-bottom: 12px;
  }

  .email-sent-title {
    font-size: 16px;
    margin-bottom: 6px;
  }

  .email-sent-text {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .email-sent-subtext {
    font-size: 12px;
    margin-bottom: 12px;
  }

  .fontshow {
    font-size: 12px;
    margin: 6px 0;
  }

  .register-button {
    height: 44px;
    font-size: 15px;
  }

  .change-email-btn,
  .resend-code-btn {
    font-size: 13px;
    min-height: 34px;
  }
}

/* 平板端优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  .register-box {
    max-width: 600px;
    padding: 25px 20px;
    border-radius: 10px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.1);
  }

  .register-title {
    font-size: 19px;
  }

  .email-sent-container {
    padding: 18px 15px;
  }

  .email-sent-icon {
    font-size: 44px;
  }

  .email-sent-title {
    font-size: 19px;
  }

  .email-sent-text {
    font-size: 15px;
  }

  .fontshow {
    font-size: 13px;
  }

  .register-button {
    height: 46px;
    font-size: 15px;
  }

  .register-options {
    gap: 15px;
  }

  .change-email-btn,
  .resend-code-btn {
    font-size: 13px;
    max-width: 180px;
  }
}
}
</style>
